package com.wushi.lenovo.asia5b.app_http;

import com.mvp.base.model.ResultModel;
import com.mvp.common.GlobalValue;
import com.wushi.lenovo.asia5b.app_model.good.InternationalDeliveryModel;
import com.wushi.lenovo.asia5b.app_model.good.LocalDeliveryModel;
import com.wushi.lenovo.asia5b.app_model.good.OrderDetailModel;
import com.wushi.lenovo.asia5b.app_model.good.OrderLogistic;
import com.wushi.lenovo.asia5b.app_model.good.OrderParcelResModel;
import com.wushi.lenovo.asia5b.app_model.good.OrderTrackModel;
import com.wushi.lenovo.asia5b.app_model.good.PaymentMethodModel;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.POST;
import retrofit2.http.Path;

/**
 * Created by zhangyuncai on 2019/2/1.
 * 关于订单的接口全在这儿
 */
public interface OrderService {
    /**
     * 订单item的button点击
     * @param url
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "{url}")
    Observable<ResultModel> button_order(@Path("url") String url, @FieldMap Map<String, Object> map
    );

    /**
     * member_id	integer	Id of the specified member
     * language_code	varchar	language code etc:’en’,’cn’ (Default: ‘en’)
     * order_id	integer	Order id
     *
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "orderdg.details.data.by.orderid")
    Observable<ResultModel<OrderDetailModel>> getOrderDetail(
            @Field("member_id") int member_id
            , @Field("language_code") String language_code
            , @Field("order_id") int order_id
    );

    /**
     * 获取物流状态
     * @param order_id
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "orderdg.details.logistic.status")
    Observable<ResultModel<OrderLogistic>> getLogisticStatus(@Field("order_id") int order_id,
                                                             @Field("member_id") int member_id
    );

    /**
     * 整个订单的物流
     *
     * @param member_id     integer	Id of the specified member
     * @param language_code varchar	language code etc:’en’,’cn’ (Default: ‘en’)
     * @param data_track    integer	Track id
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "orderdg.details.get.order.track.data")
    Observable<ResultModel<List<OrderTrackModel>>> getOrderTrackData(
            @Field("member_id") int member_id
            , @Field("language_code") String language_code
            , @Field("data_track") int data_track
    );

    /**
     * 单个商品的物流
     *
     * @param member_id     integer	Id of the specified member
     * @param language_code varchar	language code etc:’en’,’cn’ (Default: ‘en’)
     * @param data_track    integer	Track id
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "orderdg.details.get.parcel.track.data")
    Observable<ResultModel<OrderParcelResModel>> getOrderParcelTrackData(
            @Field("member_id") int member_id
            , @Field("language_code") String language_code
            , @Field("data_track") int data_track
    );

    /**
     * 获取本地物流方式
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "cart.get.local.delivery.methods")
    Observable<ResultModel<LocalDeliveryModel>> getLocalDeliveryMethods(
            @FieldMap Map<String, Object> map);

    /**
     * 获取国际物流方式
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "cart.get.international.delivery.methods")
    Observable<ResultModel<InternationalDeliveryModel>> getInternationalDeliveryMethods(
            @FieldMap Map<String, Object> map);

    /**
     * 获取支付方式
     *
     * @param map
     * @return
     */
    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "cart.get.payment.methods")
    Observable<ResultModel<PaymentMethodModel>> getPaymentMethods(
            @FieldMap Map<String, Object> map);


    @FormUrlEncoded
    @POST(GlobalValue.Base_Version_Url + "cart.validate.payment.password")
    Observable<ResultModel> validatePaymentPassword(
            @Field("member_id") int member_id,
            @Field("password") String password
    );
}
